using System.IO;
using UnityEngine;
using UnityEditor;
using System.Collections.Generic;


namespace ABA
{
    public class CopyFGUISysPkgToRes
    {
        private CopyFGUISysPkgToRes(){}

        [MenuItem("ABA/Tools/拷贝FGUISysPkg到Resources", false, 10000)]
        static void CopyFGUISysPkgToResTool()
        {
            // 拷贝 sys_fui.bytes sys_atlas0.png 到Resources

            string resPath = Application.dataPath + "/Resources";
            if (!Directory.Exists(resPath))
            {
                Debug.LogError("Resources 文件夹不存在！");
                return;
            }

            string sourcePath = Application.dataPath + "/MyAssets/FGUIExport/sys_fui.bytes";
            if (!File.Exists(sourcePath))
            {
                Debug.LogError($"{sourcePath} 不存在！");
                return;
            }
            string destinationPath = resPath + "/sys_fui.bytes";
            FileUtil.ReplaceFile(sourcePath, destinationPath);

            string sourcePath1 = Application.dataPath + "/MyAssets/FGUIExport/sys_atlas0.png";
            if (!File.Exists(sourcePath1))
            {
                Debug.LogError($"{sourcePath1} 不存在！");
                return;
            }
            string destinationPath1 = resPath + "/sys_atlas0.png";
            FileUtil.ReplaceFile(sourcePath1, destinationPath1);

            string sourcePath2 = Application.dataPath + "/MyAssets/FGUIExport/sys_atlas1.png";
            if (File.Exists(sourcePath2))
            {
                string destinationPath2 = resPath + "/sys_atlas1.png";
                FileUtil.ReplaceFile(sourcePath2, destinationPath2);
            }

            AssetDatabase.Refresh();

            Debug.Log("拷贝 sys_fui.bytes sys_atlas0.png 到Resources 完成");
        }
    }
}
